package com.usian.controller;

import com.usian.pojo.TbItemCat;
import com.usian.service.TBItemCategoryService;
import com.usian.utils.CatResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author 韩耀东
 * @date 2021/1/6 10:07
 */
@RestController
@RequestMapping("/itemCategory")
public class TBItemCategoryController {
    @Autowired
    private TBItemCategoryService itemCategoryService;

    /**
     * @return com.usian.utils.Result
     * @Author 韩耀东
     * @Description //TODO 根据类目 ID 查询当前类目的子节点
     * @Date 2021/1/6 10:04
     * @Param [id]
     **/
    @RequestMapping("/selectItemCategoryByParentId")
    public List<TbItemCat> selectItemCategoryByParentId(@RequestParam(defaultValue = "0") Long id) {
        return itemCategoryService.selectItemCategoryByParentId(id);
    }

    /**
     * @Author 韩耀东
     * @Description //TODO 左侧商品分类接口
     * @Date 2021/1/12 17:10
     * @Param [id]
     * @return com.usian.utils.Result
     **/
    @RequestMapping("/selectItemCategoryAll")
    public CatResult  selectItemCategoryAll() {
        return itemCategoryService.selectItemCategoryAll();
    }
}
